package faceoff.sample;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;

public class EHCacheManager {
	
	public static final String CACHE_NAME = "simpleBeanCache";
	
	public Cache getCache(){
		CacheManager cacheManager = CacheManager.create();
		return cacheManager.getCache(CACHE_NAME);
	}
	
	public Element readCache(String id){
		return this.getCache().get(id);
	}
	
	public void updateCache(String id , Object o){
		Element newElement = new Element(id, o);
		this.getCache().put(newElement);
	}
	
	public void deleteCache(String id){
		this.getCache().remove(id);
	}
			
}
